Programming Assignment 3
Implement and Test the List Class Implemented Using Singly Linked List

Assigned October 27, 2003
Due: November 3, 2003


The Assignment:
In the previous assignment, you implemented the List ADT using a fixed sized array. In this assignment, you will implement and test the List class using a singly linked list to store the List's items.
 
________________
Files that you must write:
  1. list2.h: The header file for the List class. Actually, you don't have to write much of this file. Just start with the version provided and add your name and other information at the top. The file contains definition of two classes: Node and List. The Node class has been completely defined and its member functions have been implemented inline.
  2. list2.cpp: The implementation file for List class. You will write all of this file, which will have the implementations of all the List's member functions.

 

Other files that you may find helpful:
  1. listtest.cpp: A simple interactive test program.
  2. listexam.cpp: A non-interactive test program that will be used to grade the correctness of your List class.

The List Class Using a Singly Linked List
Discussion of the Assignment

The previous assignment (2) asked you to use a fixed array to implement the List ADT discussed in the lectures. Such an implementation has the limitation on the number of elements that can be stored in the List. In this assignment, the List ADT will be implemented using a singly linked structure. This will not have the size limitation. Internally, memory of linked list nodes will be allocated, the data will be stored in the node and the new node will be linked into the singly linked structure using the insert or attach member functions. However, the List ADT stays the same; the internal implementation must not have an impact on the behavior of the List ADT.

As always, do your work in small pieces. For example, your first version of the List could have only a constructor, start, insert, advance, and current. Other member functions can be stubs.

Use the interactive test program and the debugger to track down errors in your implementation. If you have an error, do not start making changes until you have identified the cause of the error.


Important Note: How to submit your assignment

We have told you many times about these measures but we have seen that you are not following these measures carefully. 
If you will not follow them you will loose marks. So read them carefully: